1:package 课本例题;
2:
3:import java.io.*;
4:public class Example09 {
5:	public static void main(String[] args) throws Exception {
6:		// 创建一个FileWriter对象用于向文件中写入数据
7:		FileWriter writer = new FileWriter("writer.txt");
8:		String str = "你好，宋利军";
9:		writer.write(str);  // 将字符数据写入到文本文件中
10:		writer.write("\r\n");  // 将输出语句换行
11:		writer.close(); // 关闭写入流，释放资源
12:	}
13:}
